package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TOutstanding;
import com.ruoyi.system.service.ITOutstandingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 毕业生在相关领域突出贡献者Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/outstanding")
public class TOutstandingController extends BaseController
{
    @Autowired
    private ITOutstandingService tOutstandingService;

    /**
     * 查询毕业生在相关领域突出贡献者列表
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:list')")
    @GetMapping("/list")
    public TableDataInfo list(TOutstanding tOutstanding)
    {
        startPage();
        List<TOutstanding> list = tOutstandingService.selectTOutstandingList(tOutstanding);
        return getDataTable(list);
    }

    /**
     * 导出毕业生在相关领域突出贡献者列表
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:export')")
    @Log(title = "毕业生在相关领域突出贡献者", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TOutstanding tOutstanding)
    {
        List<TOutstanding> list = tOutstandingService.selectTOutstandingList(tOutstanding);
        ExcelUtil<TOutstanding> util = new ExcelUtil<TOutstanding>(TOutstanding.class);
        util.exportExcel(response, list, "毕业生在相关领域突出贡献者数据");
    }

    /**
     * 获取毕业生在相关领域突出贡献者详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tOutstandingService.selectTOutstandingById(id));
    }

    /**
     * 新增毕业生在相关领域突出贡献者
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:add')")
    @Log(title = "毕业生在相关领域突出贡献者", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TOutstanding tOutstanding)
    {
        return toAjax(tOutstandingService.insertTOutstanding(tOutstanding));
    }

    /**
     * 修改毕业生在相关领域突出贡献者
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:edit')")
    @Log(title = "毕业生在相关领域突出贡献者", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TOutstanding tOutstanding)
    {
        return toAjax(tOutstandingService.updateTOutstanding(tOutstanding));
    }

    /**
     * 删除毕业生在相关领域突出贡献者
     */
    @PreAuthorize("@ss.hasPermi('system:outstanding:remove')")
    @Log(title = "毕业生在相关领域突出贡献者", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tOutstandingService.deleteTOutstandingByIds(ids));
    }
}
